import { objToParams } from '@/utils/ajax'
export const JSONP = (url, params, callback) => {
    const script = document.createElement('script')
    const funName = 'Jsonp_callback_fun_' + Math.floor(Math.random() * Math.pow(10, 10)).toString(16)
    window[funName] = function (...args) {
        callback(...args)
    }
    script.src = `${url}${objToParams({ callback: funName, ...params })}`
    document.body.appendChild(script)
}